package com.zhuss.repair.repair;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.repair.repair.SearchRepairBo;
import com.zhuss.bean.bo.repair.repairAudit.RepairAuditFanKuiBo;
import com.zhuss.bean.bo.repair.repairAudit.RepairAuditPaiDanBo;
import com.zhuss.bean.bo.repair.repairAudit.RepairAuditQianShouBo;
import com.zhuss.bean.bo.repair.repairAudit.RepairAuditPaiDanBackBo;
import com.zhuss.bean.bo.repair.repairAudit.RepairWuyeBo;
import com.zhuss.bean.bo.repair.repairKancha.KanchaQTBo;
import com.zhuss.bean.bo.repair.repairKancha.RepairKanchaBo;
import com.zhuss.bean.bo.repair.repairKancha.WeiXiuGoodsBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.common.SelectVo;
import com.zhuss.core.processor.CompanyRead;
import com.zhuss.core.processor.DeptRead;
import com.zhuss.core.processor.EnumConfig;
import com.zhuss.core.processor.UserRead;
import com.zhuss.exception.WpsException;

/**
 * 报修操作service（基本操作）
 * @author hxx
 * @Date 2020/02/28 16:01
 *
 */
@Component("repairKanchaOperateService")
public class RepairKanchaOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("repairKanchaEdit")
	private Processor<Object, RepairKanchaBo> repairKanchaEdit;
	
	@Autowired
	@Qualifier("repairKanchaQTEdit")
	private Processor<Object, KanchaQTBo> repairKanchaQTEdit;
	
	@Autowired
	@Qualifier("repairKanchaComplete")
	private Processor<Object, RepairKanchaBo> repairKanchaComplete;
	
	@Autowired
	@Qualifier("weiXiuGoodsCreate")
	private Processor<Object, WeiXiuGoodsBo> weiXiuGoodsCreate;
	
	@Autowired
	@Qualifier("weiXiuGoodsRead")
	private Processor<Object, WeiXiuGoodsBo> weiXiuGoodsRead;
	
	@Autowired
	@Qualifier("repairSubmitToWeiXiu")
	private Processor<Object, RepairKanchaBo> repairSubmitToWeiXiu;
	
	@Autowired
	@Qualifier("enumConfig")
	private EnumConfig enumConfig;

	//获取物业公司
	/*@Autowired
	@Qualifier("companyRead")
	private CompanyRead companyRead;*/
	//获取物业公司下属维修人员
	/*@Autowired
	@Qualifier("userRead")
	private UserRead userRead;*/
	
	
	@Override
	public Void create(Object param) throws WpsException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Void update(Object param) throws WpsException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Void delete(Object param) throws WpsException {
		// TODO Auto-generated method stub
		return null;
	}

	

	/**
	 * 编辑勘察信息
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void kanchaEdit(Object param) throws WpsException {
		RepairKanchaBo bo = (RepairKanchaBo) param;
		repairKanchaEdit.process(bo);
		return null;
	}

	/**
	 * 第三方勘察信息保存
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void kanchaQTEdit(Object param) throws WpsException {
		KanchaQTBo bo = (KanchaQTBo) param;
		repairKanchaQTEdit.process(bo);
		return null;
	}
	
	/**
	 * 勘察完成
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void completeKancha(Object param) throws WpsException {
		RepairKanchaBo bo = (RepairKanchaBo) param;
		repairKanchaComplete.process(bo);
		return null;
	}
	
	/**
	 * 物料数据获取（字典）
	 */
	@Transactional(rollbackFor = Exception.class)
	public Object listRepairFoodsCategory(Object param) throws WpsException {
		SearchRepairBo bo = (SearchRepairBo) param;
		List<SelectVo> list = enumConfig.listRepairFoodsCategory(bo.getArea());
		return list;
	}

	//保存维修物料
	@Transactional(rollbackFor = Exception.class)
	public Void saveWeiXiuGoods(Object param) throws WpsException {
		WeiXiuGoodsBo bo = (WeiXiuGoodsBo) param;
		weiXiuGoodsCreate.process(bo);
		return null;
	}

	//获取维修物料
	@Transactional(rollbackFor = Exception.class)
	public Object getWeiXiuFoods(Object param) throws WpsException {
		WeiXiuGoodsBo bo = (WeiXiuGoodsBo) param;
		Object obj = weiXiuGoodsRead.process(bo);
		return obj;
	}

	//
	@Transactional(rollbackFor = Exception.class)
	public Void submitToWeiXiu(Object param) throws WpsException {
		RepairKanchaBo bo = (RepairKanchaBo) param;
		repairSubmitToWeiXiu.process(bo);
		return null;
	}

	
	

	
	

	
}

